package com.ruoyi.web.controller.dispatch;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DispatchPressureAlarmStatistics;
import com.ruoyi.system.service.IDispatchPressureAlarmStatisticsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 压力告警统计结果Controller
 * 
 * @author ruoyi
 * @date 2025-03-02
 */
@RestController
@RequestMapping("/system/dispatchPressureAlarmStatistics")
public class DispatchPressureAlarmStatisticsController extends BaseController
{
    @Autowired
    private IDispatchPressureAlarmStatisticsService dispatchPressureAlarmStatisticsService;

    /**
     * 查询压力告警统计结果列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureAlarmStatistics:list')")
    @GetMapping("/list")
    public TableDataInfo list(DispatchPressureAlarmStatistics dispatchPressureAlarmStatistics)
    {
        startPage();
        List<DispatchPressureAlarmStatistics> list = dispatchPressureAlarmStatisticsService.selectDispatchPressureAlarmStatisticsList(dispatchPressureAlarmStatistics);
        return getDataTable(list);
    }

    /**
     * 导出压力告警统计结果列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureAlarmStatistics:export')")
    @Log(title = "压力告警统计结果", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DispatchPressureAlarmStatistics dispatchPressureAlarmStatistics)
    {
        List<DispatchPressureAlarmStatistics> list = dispatchPressureAlarmStatisticsService.selectDispatchPressureAlarmStatisticsList(dispatchPressureAlarmStatistics);
        ExcelUtil<DispatchPressureAlarmStatistics> util = new ExcelUtil<DispatchPressureAlarmStatistics>(DispatchPressureAlarmStatistics.class);
        util.exportExcel(response, list, "压力告警统计结果数据");
    }

    /**
     * 获取压力告警统计结果详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureAlarmStatistics:query')")
    @GetMapping(value = "/{pressureAlarmStatisticsId}")
    public AjaxResult getInfo(@PathVariable("pressureAlarmStatisticsId") Long pressureAlarmStatisticsId)
    {
        return success(dispatchPressureAlarmStatisticsService.selectDispatchPressureAlarmStatisticsByPressureAlarmStatisticsId(pressureAlarmStatisticsId));
    }

    /**
     * 新增压力告警统计结果
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureAlarmStatistics:add')")
    @Log(title = "压力告警统计结果", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DispatchPressureAlarmStatistics dispatchPressureAlarmStatistics)
    {
        return toAjax(dispatchPressureAlarmStatisticsService.insertDispatchPressureAlarmStatistics(dispatchPressureAlarmStatistics));
    }

    /**
     * 修改压力告警统计结果
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureAlarmStatistics:edit')")
    @Log(title = "压力告警统计结果", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DispatchPressureAlarmStatistics dispatchPressureAlarmStatistics)
    {
        return toAjax(dispatchPressureAlarmStatisticsService.updateDispatchPressureAlarmStatistics(dispatchPressureAlarmStatistics));
    }

    /**
     * 删除压力告警统计结果
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureAlarmStatistics:remove')")
    @Log(title = "压力告警统计结果", businessType = BusinessType.DELETE)
	@DeleteMapping("/{pressureAlarmStatisticsIds}")
    public AjaxResult remove(@PathVariable Long[] pressureAlarmStatisticsIds)
    {
        return toAjax(dispatchPressureAlarmStatisticsService.deleteDispatchPressureAlarmStatisticsByPressureAlarmStatisticsIds(pressureAlarmStatisticsIds));
    }
}
